#include<iostream>
#include<cmath>
#include<fstream>
#include<string>
using namespace std;

#include"library.h"

void f(double x, double & y, double & dy){
	y = x*x*x - 2*x*x -5*x +6;
	dy = 2*x*x - 4*x -5;
}

int main(){
	
	double a=0, b=10, x, y, dy;
	x = Newton_findroot( f, a, b, 1E-6);
	f(x, y, dy);
	cout<<" The root is x="<<x<<"  f(x)="<<y<<endl;
	return 0;
}
